//
//  FriendMsgCell.m
//  FootPrint
//
//  Created by alex tao on 3/25/13.
//  Copyright (c) 2013 alex tao. All rights reserved.
//

#import "FriendMsgCell.h"

@implementation FriendMsgCell

- (void)internalInit
{
    [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:self options:nil];
    
    _realView.frame = self.bounds;
    [self.contentView addSubview:_realView];
    
    self.contentView.backgroundColor = [UIColor clearColor];
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self internalInit];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)dealloc {
    [_realView release];
    [_iconImageView release];
    [_nameLabel release];
    [_timeLabel release];
    [super dealloc];
}

- (void) updateWithBoardMsg:(EventBoardQueryResponseMessage_Board*)msg
{
    _nameLabel.text = msg.user.nickName;
    
    if (!msg.user.portrait.isSys) {
        [_iconImageView loadAsyncImage:msg.user.portrait.imageUrl];
    } else {
        [_iconImageView setSysImageWithId:msg.user.portrait.id];
    }
    
    _timeLabel.text = [GToolUtil dateStrFromDataFormat2:msg.time];
    
    _msgLabel.text = msg.content;

}

@end
